package svc

import (
	"api/internal/config"
	"api/internal/middleware"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"house_srv/houseclient"
)

type ServiceContext struct {
	Config       config.Config
	Authtemplate rest.Middleware
	HouseSrv     houseclient.House
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:       c,
		Authtemplate: middleware.NewAuthtemplateMiddleware().Handle,
		HouseSrv:     houseclient.NewHouse(zrpc.MustNewClient(c.HouseSrv)),
	}
}
